#ifndef YIGCHAT_H
#define YIGCHAT_H

// System includes
#include <QWidget>
#include <QTextEdit>
#include <QLineEdit>

// Local includes

class Yig;

/**
*   YigChat
*   Chat window that display the chat conversation of the users over the network
*/
class YigChat : public QObject
{
    Q_OBJECT

public:

    /**
    *   YigChat constructor
    *   @param Yig* pointer to the parent yig class
    *   @param QObject *parent = 0 Should stay 0 so this is a floating menu
    */
    explicit YigChat(Yig* yig, QObject *parent = 0);

    /**
    *   YigChat Deconstuctor
    */
    ~YigChat();

    /** move chat elements */
    void moveElements(int x, int y);

    /** show chat elements */
    void showElements();

    /** hide chat elements */
    void hideElements();

signals:

    /** emitted when the user wants to send a message over chat */
    void sendMessage(QString message);

public slots:

    /** called when the user wants to send messages */
    void grabKeyboardFocus();

    /** called when the network updates the chat conversation */
    void receiveMessage(QString message);

private slots:

    /** called when the chat entry submits a message */
    void submitChatLine();

private:

    /** widget element for the chat display */
    QWidget* displayWidget;

    /** widget element for the chat entry */
    QWidget* entryWidget;

    /** the widget that display the chat conversation */
    QTextEdit* chatDisplay;

    /** the widget where the local user enters messages to be sent */
    QLineEdit* chatEntry;

    /** pointer to the parent  yig class, used for networking */
    Yig* mYig;
};

#endif // YIGCHAT_H
